﻿using Nest;

namespace XYS.Service.Core.Util.Helper
{
    /// <summary>
    /// ES 客户端
    /// </summary>
    public static class ElasticClientHelper
    {
        /// <summary>
        /// 客户端集合
        /// </summary>
        public static Dictionary<string, IElasticClient> ElasticClients { get; set; } = new Dictionary<string, IElasticClient>();

        /// <summary>
        /// 获取客户端
        /// </summary>
        /// <param name="elasticName"></param>
        /// <returns></returns>
        public static IElasticClient GetClient(string elasticName)
        {
            ElasticClients.TryGetValue(elasticName, out IElasticClient client);
            return client;
        }
    }
}
